﻿

using ManagoMes.Read.API.Applications.ProductionScheduling;
using ManagoMes.Read.API.Applications.WangDefa;
using ManagoMes.Read.API.Applications.WorkflowEngine;
using MangoMes.Commont.DapperHelps;
using MangoMes.Commont.Domain.Jocker;
using MangoMes.Commont.DTOs;
using MangoMes.Write.API.Applications.Login;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;

namespace ManagoMes.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class AcquireController : ControllerBase
    {

        private readonly IMediator mediator;

        public AcquireController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        ///日志列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultsDTO<RecordsLogin>> LoginHhtml(LoginHhtmlcommond request)
        {

            try
            {
                var list = await mediator.Send(request);


                return list;
            }
            catch (Exception)
            {

                throw;
            }

        }
        /// <summary>
        /// 仓库列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultsDTO<Stashs>> StashHtml(StashHtmlCommond request, CancellationToken cancellationToken)
        {
            try
            {
                var list = await mediator.Send(request);


                return list;
            }
            catch (Exception)
            {

                throw;
            }

        }
        /// <summary>
        /// 工序列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultsDTO<processk>> processhtml(processhtmlCommond request, CancellationToken cancellationToken)
        {
            try
            {
                var list = await mediator.Send(request);


                return list;
            }
            catch (Exception)
            {

                throw;
            }
        

        }

        /// <summary>
        /// 工序赋值
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultsDTO<processk>> processBack(processBackcommond request, CancellationToken cancellationToken)
        {

            try
            {
                var list =await mediator.Send(request);


                return list;
            }
            catch (Exception)
            {

                throw;
            }

        }
        /// <summary>
        /// 对应工序步骤
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// 
        [HttpPost]
        public async Task<ResultsDTO<ProcessStep>> StepDescriptionHtml(StepDescriptionHtmlCommond request, CancellationToken cancellationToken)
        {
            try
            {
                var list =await mediator.Send(request);
                return list;
            }
            catch (Exception)
            {
                throw;
            }




        }
        /// <summary>
        /// 审批
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultsDTO> WorkflowEngine(WorkflowEngineCommond request, CancellationToken cancellationToken)
        {
            try
            {
                var list = await mediator.Send(request);
                return list;
            }
            catch (Exception)
            {

                throw;
            }
           

        }



    }
}

